<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>在Vue中使用插槽(slot)</title>
    <script src="vue.js"></script>
</head>
<body>
<div id="app">
    <child>
        <div class="header" slot="header">header</div>
        <div class="footer" slot="footer">footer</div>
    </child>
</div>
<script>
    var child = {
        template:`<div>
                    <slot name="header"></slot>
                    <div>content</div>
                    <slot name="footer"></slot>
                  </div>`
    };
    var vm = new Vue({
        el:"#app",
        components:{
            child:child
        },
        data:{},
        methods:{}
    });
</script>
</body>
</html>